﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="IndustrySecond.aspx.cs" Inherits="Taxes.Industory.IndustrySecond" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
      <script type="text/javascript">
          function Cancel() {
              window1.hide();
              tfTypeCode.setValue("");
              tfType.setValue("");
              tbHidden.setValue("添加");
          }
          var command = function (cmd, record, rowIndex) {
              if (cmd === 'deleteIndustry') {
                  var result = confirm("删除后无法恢复，确定删除吗?")
                  if (result) {
                      Ext.net.DirectMethods.DeleteType(record.id,
                    {
                        success: function (result) {
                            if (result == 1) {
                                Ext.Msg.alert('提示', "删除成功");
                                grid.reload();
                            }
                            else {
                                Ext.Msg.alert('提示', "删除失败");
                            }
                        }
                    });
                  }
              }
              else if (cmd == "editIndustry") {
                  window.location.href = "IndustryThird.aspx?ID=" + record.id;
              }
              else if (cmd == "updateIndustry") {
                  tfTypeCode.setValue(record.data.industry_no);
                  tfType.setValue(record.data.industry_name);
                  tbHidden.setValue("修改");
                  tbHiddenID.setValue(record.id);
                  window1.show();
              }
          }
          function JumpImport() {
              window.location.href = "IndustoryImport.aspx";
          }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Window runat="server" ID="window1" Width="600" Height="150" Title="行业" Padding="5"
            Layout="FormLayout" Hidden="true">
            <Items>
                <ext:Hidden runat="server" ID="tbHidden" Text="增加">
                </ext:Hidden>
                <ext:Hidden runat="server" ID="tbHiddenID" Text="">
                </ext:Hidden>
                <ext:TextField ID="tfTypeCode" runat="server" AnchorHorizontal="100%" AllowBlank="false"
                    FieldLabel="行业代码<font color='red'>*</font>">
                </ext:TextField>
                <ext:TextField ID="tfType" runat="server" AllowBlank="false" AnchorHorizontal="100%"
                    FieldLabel="行业<font color='red'>*</font>">
                </ext:TextField>
            </Items>
            <Buttons>
                <ext:Button ID="btnSave" runat="server" Icon="Disk" Text="保存">
                    <DirectEvents>
                        <Click OnEvent="btnAdd_Click">
                            <EventMask ShowMask="True" Msg="正在保存..." MinDelay="1000" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Icon="Cancel" Text="取消">
                    <Listeners>
                        <Click Fn="Cancel" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:Window>
        <ext:Store ID="storeIndustryTop" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="ID">
                    <Fields>
                        <ext:RecordField Name="ID" Type="Int">
                        </ext:RecordField>
                        <ext:RecordField Name="industry_no" Type="String">
                        </ext:RecordField>
                        <ext:RecordField Name="industry_name" Type="String">
                        </ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel StoreID="storeIndustryTop" ID="grid" runat="server" Title="行业管理" Frame="true"
            AutoHeight="true" AutoWidth="true" StripeRows="true" Height="400" TrackMouseOver="True"
            AutoScroll="true">
            <LoadMask ShowMask="true" Msg="正在加载，请稍后." />
            <BottomBar>
                <ext:PagingToolbar runat="server" PageSize="10" StoreID="storeIndustryTop" DisplayInfo="true">
                </ext:PagingToolbar>
            </BottomBar>
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="colCode" DataIndex="industry_no" Header="行业代码">
                    </ext:Column>
                    <ext:Column ColumnID="colType" DataIndex="industry_name" Header="行业名称">
                    </ext:Column>
                    <ext:CommandColumn ColumnID="colDelete" Header="操作">
                        <Commands>
                            <ext:GridCommand Icon="ApplicationFormEdit" ToolTip-Text="修改行业大类"  CommandName="updateIndustry">
                                <ToolTip Text="修改行业大类" />
                            </ext:GridCommand>
                            <ext:CommandSeparator />
                            <ext:GridCommand Icon="ApplicationEdit" ToolTip-Text="修改行业小类"  CommandName="editIndustry">
                                <ToolTip Text="修改行业小类" />
                            </ext:GridCommand>
                             <ext:CommandSeparator />
                            <ext:GridCommand Icon="Delete" ToolTip-Text="删除行业大类" CommandName="deleteIndustry">
                                <ToolTip Text="删除行业大类" />
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>
            <Listeners>
                <Command Fn="command" />
            </Listeners>
            <Buttons>
                <ext:Button ID="btnAdd" runat="server" Text="添加行业大类" Icon="Add">
                    <Listeners>
                        <Click Handler="#{window1}.show()" />
                    </Listeners>
                </ext:Button>
      
            </Buttons>
        </ext:GridPanel>
    </div>
    </form>
</body>
</html>
